package com.sync.data.mce.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sync.data.base.BaseEntity;
import com.sync.data.common.annotation.*;
import com.sync.data.common.obj.annoation.ObjectPrefix;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.Transient;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.util.Date;

/**
 * 医院信息表(mdm_hosp: table)实体类
 *
 * @author zxr
 * @since 2024-08-02 17:34:54
 */
@Getter
@Setter
@Entity
@ObjectInfo(relation = true)
@ObjectPrefix("mhos")
//@DiscriminatorValue("mdmHosp")
public class MdmHosp extends BaseEntity {


    @FieldProps(type = FieldType.DICT, label = "是否集团内客户", renderType = RenderType.Select)
    private String isInternal;


    @FieldProps(type = FieldType.STRING, label = "客户编码")
    private String mdmCode;

    @FieldProps(type = FieldType.STRING, label = "医院ID")
    private String hcoCode;

    @FieldProps(type = FieldType.STRING, label = "客户名称")
    private String hcoName;

    @FieldProps(type = FieldType.STRING, label = "客户简称")
    private String hcoAlias1;

    @FieldProps(type = FieldType.STRING, label = "客户英文名称")
    private String hcoNameEn;

    @FieldProps(type = FieldType.STRING, label = "曾用名")
    private String hcoAlias2;

    //
    @FieldProps(type = FieldType.STRING, label = "客户证件类型")
    private String certificateTypeRef;

    @FieldProps(type = FieldType.STRING, label = "统一社会信用代码")
    private String certificateNumber;

    @FieldProps(type = FieldType.STRING, label = "医疗机构执业许可证号")
    private String medicalLicense;

    @Transient
    @FieldProps(type = FieldType.STRING, label = "国家代码",reference = "sysRegionCountry.code",readOnly = true)
    private String sysCountryCode;

    @Transient
    @FieldProps(type = FieldType.STRING, label = "省市代码",reference = "sysRegionProvince.code",readOnly = true)
    private String sysProvinceCode;

    @Transient
    @FieldProps(type = FieldType.STRING, label = "地级市代码",reference = "sysRegionCity.code",readOnly = true)
    private String sysCityCode;

    @Transient
    @FieldProps(type = FieldType.STRING, label = "区县代码",reference = "sysRegionDistrict.code",readOnly = true)
    private String sysDistrictCode;

    @FieldProps(type = FieldType.STRING, label = "国家名称")
    private String hcoCountry;

    @FieldProps(type = FieldType.STRING, label = "省市名称")
    private String hcoProvince;

    @FieldProps(type = FieldType.STRING, label = "地级市名称")
    private String hcoCity;

    @FieldProps(type = FieldType.STRING, label = "区县名称")
    private String hcoDistrict;

    @FieldProps(type = FieldType.STRING, label = "注册地址")
    private String hcoAddress;

    //
    @FieldProps(type = FieldType.STRING, label = "邮编")
    private String hcoPostCode;

    //
    @FieldProps(type = FieldType.STRING, label = "经度")
    private String longitude;

    //
    @FieldProps(type = FieldType.STRING, label = "纬度")
    private String latitude;

    @FieldProps(type = FieldType.DICT, label = "管理级别", renderType = RenderType.Select)
    private String managementLevel;

    @FieldProps(type = FieldType.DICT, label = "医院类别", renderType = RenderType.Select)
    private String hcoType;

    @FieldProps(type = FieldType.DICT, label = "医院性质", renderType = RenderType.Select)
    private String hcoProperty;

    @FieldProps(type = FieldType.DICT, label = "医院等次", renderType = RenderType.Select)
    private String hcoGrade;

    @FieldProps(type = FieldType.DICT, label = "医院级别", renderType = RenderType.Select)
    private String hcoLevel;

    @FieldProps(type = FieldType.STRING, label = "医保机构代码")
    private String hcoInstitutionCode;

    //
    @FieldProps(type = FieldType.STRING, label = "医疗机构类型")
    private String institutionType;

    //
    @FieldProps(type = FieldType.STRING, label = "所有制类型")
    private String ownershipType;

    //
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @FieldProps(type = FieldType.DATE,label = "医疗机构执业许可证失效日期",renderType = RenderType.DatePicker)
    private Date licenseExpiry;

    @FieldProps(type = FieldType.DICT, label = "企业类型", renderType = RenderType.Select)
    private String enterpriseType;


    @FieldProps(type = FieldType.STRING, label = "所属行业")
    private String industrySector;

    @FieldProps(type = FieldType.STRING, label = "法定代表人")
    private String legalRepresentative;

    @FieldProps(type = FieldType.STRING, label = "登记状态")
    private String registerStatus;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date busStartDate;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date busEndDate;

    @FieldProps(type = FieldType.STRING, label = "经营范围")
    private String businessScope;

    @FieldProps(type = FieldType.STRING, label = "分院数",renderType = RenderType.NumberInput)
    private Integer branchCount;

    //
    @FieldProps(type = FieldType.STRING, label = "分院地址")
    private String branchAddress;

    @FieldProps(type = FieldType.STRING, label = "年诊疗人次",renderType = RenderType.NumberInput)
    private Integer annualVisits;

    @FieldProps(type = FieldType.STRING, label = "年总手术量",renderType = RenderType.NumberInput)
    private Integer hcoOperationQuantity;

    @FieldProps(type = FieldType.STRING, label = "年日间门诊手术量",renderType = RenderType.NumberInput)
    private Integer annualDaycaseSurgeries;

    @FieldProps(type = FieldType.STRING, label = "年出院人数",renderType = RenderType.NumberInput)
    private Integer annualDischarges;

    @FieldProps(type = FieldType.STRING, label = "床位数",renderType = RenderType.NumberInput)
    private Integer hcoBedsQuantity;

    @FieldProps(type = FieldType.STRING, label = "职工总数",renderType = RenderType.NumberInput)
    private String totalStaff;

    @FieldProps(type = FieldType.STRING, label = "执业医师总数",renderType = RenderType.NumberInput)
    private Integer licensedDoctors;

    //
    @FieldProps(type = FieldType.STRING, label = "电话")
    private String hcoPhone;

    //
    @FieldProps(type = FieldType.STRING, label = "关键联系人")
    private String keyContact;

    //
    @FieldProps(type = FieldType.STRING, label = "关键联系人联系方式")
    private String contactInfo;

    @FieldProps(type = FieldType.STRING, label = "官网")
    private String website;

    @FieldProps(type = FieldType.STRING, label = "医院简介")
    private String hcoBrief;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @FieldProps(type = FieldType.DATE,label = "成立时间",renderType = RenderType.DatePicker)
    private Date establishedDate;


    @FieldProps(type = FieldType.STRING, label = "状态原因")
    private String statusReason;

    @FieldProps(type = FieldType.STRING, label = "EAS编码",readOnly = true)
    private String easCode;

    @FieldProps(type = FieldType.STRING, label = "医院等级")
    private String hcoClass;

    @FieldProps(type = FieldType.STRING, label = "医院标准类别")
    private String hcoStandardCategory;

    @FieldProps(type = FieldType.STRING, label = "医院子类别")
    private String hcoSubCategory;

    @FieldProps(type = FieldType.STRING, label = "医院简称")
    private String hcoNameAbbr;

    @FieldProps(type = FieldType.STRING, label = "医院曾用名/别称1(英文)")
    private String hcoAliasEn1;

    @FieldProps(type = FieldType.STRING, label = "医院曾用名/别称2(英文)")
    private String hcoAliasEn2;

    @FieldProps(type = FieldType.STRING, label = "大区/州")
    private String hcoRegion;

    @FieldProps(type = FieldType.STRING, label = "传真")
    private String hcoTax;

    @FieldProps(type = FieldType.STRING, label = "日门诊量",renderType = RenderType.NumberInput)
    private Integer hcoPatientsQuantity;

    @FieldProps(type = FieldType.STRING, label = "住院人数（年）",renderType = RenderType.NumberInput)
    private Integer hcoInhospitalQuantity;

    @FieldProps(type = FieldType.STRING, label = "新生儿数（年）",renderType = RenderType.NumberInput)
    private Integer hcoNewbornQuantity;

    @FieldProps(type = FieldType.STRING, label = "医院网址")
    private String hcoWebUrl;

    @FieldProps(type = FieldType.STRING, label = "医院主要专长编号", sourceObject = "MdmSpec", renderField = "mdmSpec", renderType = RenderType.SourcePicker)
    private String hcoPriSpecialtyId;

    @FieldProps(type = FieldType.STRING, label = "医院主要专长")
    private String hcoPriSpecialty;

    @FieldProps(type = FieldType.STRING, label = "医院验证状态")
    private String hcoValidateStatus;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @FieldProps(type = FieldType.DATE,label = "医院验证时间",renderType = RenderType.DatePicker)
    private Date hcoValidateTime;

    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @FieldProps(type = FieldType.DATE,label = "医院确认时间",renderType = RenderType.DatePicker)
    private Date hcoConfirmTime;

    @FieldProps(type = FieldType.STRING, label = "总院编码")
    private String generalHcoCode;

    @FieldProps(type = FieldType.STRING, label = "总院名称")
    private String generalHcoName;

    @FieldProps(type = FieldType.STRING, label = "是否定点医疗机构")
    private String isDesignated;

    @FieldProps(type = FieldType.STRING, label = "父级医院id")
    private String pid;

    @FieldProps(type = FieldType.STRING, label = "是否有子医院")
    private String hasChild;

    @FieldProps(type = FieldType.STRING, label = "原始数据来源")
    private String dataFrom;

    @FieldProps(type = FieldType.STRING, label = "原始数据id")
    private String legacyId;

    @FieldProps(type = FieldType.DICT, label = "数据状态", renderType = RenderType.Select, renderAs = RenderAs.Tag)
    private String isActive;

    @FieldProps(type = FieldType.STRING, label = "所属部门")
    private String sysOrgCode;

    @FieldProps(type = FieldType.STRING, label = "删除状态")
    private String delFlag;

    @FieldProps(type = FieldType.STRING, label = "版本号")
    private Integer version;

    @FieldProps(type = FieldType.STRING, label = "MDM编码")
    private String mdmCode2;

    public void setHcoName(String hcoName) {
        this.hcoName = hcoName;
        this.name = hcoName;
    }

}

